#!/bin/bash


# start mongod
/usr/bin/mongod --config /etc/mongodb.conf &
sleep 10

# create mongo user
mongo <<EOF
use autoscrapy;  
db.createUser({  
  user: "autoscrapy",
  pwd: "123456",
  roles: [{
      role: "readWrite",
      db: "autoscrapy"
    }
  ]
});
EOF

# start autoserver
export FLASK_APP=/autoscrapy/autoscrapy_server.py
flask run &
# start autoagent
python /autoscrapy/autoscrapy_agent.py
